import os
import configparser

pro_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


class Config:
    def __init__(self, filename="config.ini"):
        self.cf = configparser.ConfigParser()
        self.cf.read(os.path.join(pro_path, "conf", filename))

    def get_server(self, option):
        return self.cf.get("server", option)

    def get_mysql(self, option):
        return self.cf.get("mysql", option)

    def get_redis(self, option):
        return self.cf.get("redis", option)

    def get_email(self, option):
        return self.cf.get("email", option)


if __name__ == "__main__":
    c = Config()
    print(c.get_server("base_url"))
